package com.mine.redis.util.controller;

import com.mine.redis.util.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author weixiao
 * @date 2024/8/20 14:12
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/sign")
    public void sign(@RequestHeader("userId") Integer userId) {
        userService.sign(userId);
    }

    /**
     * 连续签到的天数
     */
    @PostMapping("/getSignCount")
    public Integer getSignCount(@RequestHeader("userId") Integer userId) {
        return userService.getSignCount(userId);
    }
}
